package cn.edu.nwsuaf.teachercenter.pojo;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Student entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "student", catalog = "exam")
public class Student implements java.io.Serializable {

	// Fields

	private String studentNo;
	private Sclass sclass;
	private String studentName;
	private String studentPassword;
	private String studentSex;
	private String studentBirth;
	private String studentIdcard;
	private Set<StudentExamScore> studentExamScores = new HashSet<StudentExamScore>(
			0);
	private Set<StudentItemExercice> studentItemExercices = new HashSet<StudentItemExercice>(
			0);
	private Set<StudentExamInfo> studentExamInfos = new HashSet<StudentExamInfo>(
			0);
	private Set<StudentExerciceRecord> studentExerciceRecords = new HashSet<StudentExerciceRecord>(
			0);
	private Set<ExerciceExamAnswer> exerciceExamAnswers = new HashSet<ExerciceExamAnswer>(
			0);
	private Set<StudentExamAnswer> studentExamAnswers = new HashSet<StudentExamAnswer>(
			0);
	private Set<StudentCourceScore> studentCourceScores = new HashSet<StudentCourceScore>(
			0);
	private Set<StudentCommonScore> studentCommonScores = new HashSet<StudentCommonScore>(
			0);

	// Constructors

	/** default constructor */
	public Student() {
	}

	/** minimal constructor */
	public Student(String studentNo, Sclass sclass, String studentName,
			String studentPassword, String studentSex, String studentBirth,
			String studentIdcard) {
		this.studentNo = studentNo;
		this.sclass = sclass;
		this.studentName = studentName;
		this.studentPassword = studentPassword;
		this.studentSex = studentSex;
		this.studentBirth = studentBirth;
		this.studentIdcard = studentIdcard;
	}

	/** full constructor */
	public Student(String studentNo, Sclass sclass, String studentName,
			String studentPassword, String studentSex, String studentBirth,
			String studentIdcard, Set<StudentExamScore> studentExamScores,
			Set<StudentItemExercice> studentItemExercices,
			Set<StudentExamInfo> studentExamInfos,
			Set<StudentExerciceRecord> studentExerciceRecords,
			Set<ExerciceExamAnswer> exerciceExamAnswers,
			Set<StudentExamAnswer> studentExamAnswers,
			Set<StudentCourceScore> studentCourceScores,
			Set<StudentCommonScore> studentCommonScores) {
		this.studentNo = studentNo;
		this.sclass = sclass;
		this.studentName = studentName;
		this.studentPassword = studentPassword;
		this.studentSex = studentSex;
		this.studentBirth = studentBirth;
		this.studentIdcard = studentIdcard;
		this.studentExamScores = studentExamScores;
		this.studentItemExercices = studentItemExercices;
		this.studentExamInfos = studentExamInfos;
		this.studentExerciceRecords = studentExerciceRecords;
		this.exerciceExamAnswers = exerciceExamAnswers;
		this.studentExamAnswers = studentExamAnswers;
		this.studentCourceScores = studentCourceScores;
		this.studentCommonScores = studentCommonScores;
	}

	// Property accessors
	@Id
	@Column(name = "student_no", unique = true, nullable = false, length = 50)
	public String getStudentNo() {
		return this.studentNo;
	}

	public void setStudentNo(String studentNo) {
		this.studentNo = studentNo;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "class_no", nullable = false)
	public Sclass getSclass() {
		return this.sclass;
	}

	public void setSclass(Sclass sclass) {
		this.sclass = sclass;
	}

	@Column(name = "student_name", nullable = false, length = 50)
	public String getStudentName() {
		return this.studentName;
	}

	public void setStudentName(String studentName) {
		this.studentName = studentName;
	}

	@Column(name = "student_password", nullable = false, length = 50)
	public String getStudentPassword() {
		return this.studentPassword;
	}

	public void setStudentPassword(String studentPassword) {
		this.studentPassword = studentPassword;
	}

	@Column(name = "student_sex", nullable = false, length = 5)
	public String getStudentSex() {
		return this.studentSex;
	}

	public void setStudentSex(String studentSex) {
		this.studentSex = studentSex;
	}

	@Column(name = "student_birth", nullable = false, length = 50)
	public String getStudentBirth() {
		return this.studentBirth;
	}

	public void setStudentBirth(String studentBirth) {
		this.studentBirth = studentBirth;
	}

	@Column(name = "student_idcard", nullable = false, length = 18)
	public String getStudentIdcard() {
		return this.studentIdcard;
	}

	public void setStudentIdcard(String studentIdcard) {
		this.studentIdcard = studentIdcard;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "student")
	public Set<StudentExamScore> getStudentExamScores() {
		return this.studentExamScores;
	}

	public void setStudentExamScores(Set<StudentExamScore> studentExamScores) {
		this.studentExamScores = studentExamScores;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "student")
	public Set<StudentItemExercice> getStudentItemExercices() {
		return this.studentItemExercices;
	}

	public void setStudentItemExercices(
			Set<StudentItemExercice> studentItemExercices) {
		this.studentItemExercices = studentItemExercices;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "student")
	public Set<StudentExamInfo> getStudentExamInfos() {
		return this.studentExamInfos;
	}

	public void setStudentExamInfos(Set<StudentExamInfo> studentExamInfos) {
		this.studentExamInfos = studentExamInfos;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "student")
	public Set<StudentExerciceRecord> getStudentExerciceRecords() {
		return this.studentExerciceRecords;
	}

	public void setStudentExerciceRecords(
			Set<StudentExerciceRecord> studentExerciceRecords) {
		this.studentExerciceRecords = studentExerciceRecords;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "student")
	public Set<ExerciceExamAnswer> getExerciceExamAnswers() {
		return this.exerciceExamAnswers;
	}

	public void setExerciceExamAnswers(
			Set<ExerciceExamAnswer> exerciceExamAnswers) {
		this.exerciceExamAnswers = exerciceExamAnswers;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "student")
	public Set<StudentExamAnswer> getStudentExamAnswers() {
		return this.studentExamAnswers;
	}

	public void setStudentExamAnswers(Set<StudentExamAnswer> studentExamAnswers) {
		this.studentExamAnswers = studentExamAnswers;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "student")
	public Set<StudentCourceScore> getStudentCourceScores() {
		return this.studentCourceScores;
	}

	public void setStudentCourceScores(
			Set<StudentCourceScore> studentCourceScores) {
		this.studentCourceScores = studentCourceScores;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "student")
	public Set<StudentCommonScore> getStudentCommonScores() {
		return this.studentCommonScores;
	}

	public void setStudentCommonScores(
			Set<StudentCommonScore> studentCommonScores) {
		this.studentCommonScores = studentCommonScores;
	}

}